import { ref } from "vue";
import axios from "axios";
export default function <T>(url: string) {

    const data = ref<T | null>(null);
    const isLoading = ref(true);
    const errorMsg = ref("");
    /*
    axios.get(url).then(res => {
        data.value = res.data;
        isLoading.value = false;
    }).catch((error) => {
        isLoading.value = false;
        errorMsg.value = error.message || '未知错误';
    });
    */

    return {
        data,
        isLoading,
        errorMsg
    }
}